package com.qianyu.project.mapper.provider;

import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.ObjectUtils;

import java.util.Map;

/**
 * @Author ww
 * @desc
 */
public class OutputProgressFilloutMapperProvider {
    public String List(Map<String,String> params){
        return new SQL(){
            {
                SELECT("p.id,project_name,fill_subject,editer_id,fill_date");
                FROM("project_info p,output_progress_fillout o");
                WHERE("o.p_id=p.id");
                if(!ObjectUtils.isEmpty(params.get("fill_subject"))){
                    WHERE("fill_subject like '%"+params.get("fill_subject")+"%'");
                }
                if(!ObjectUtils.isEmpty(params.get("editer_id"))){
                    WHERE("editer_id like '%"+params.get("editer_id")+"%'");
                }
                if(!ObjectUtils.isEmpty(params.get("fill_date"))){
                    WHERE("fill_date >= '"+params.get("fill_date")+"'");
                }
            }
        }.toString();
    }

}
